// pages/main/main.ts
let APP = getApp();
import {
	request
} from '../../utils/util';
Page({
	/**
	 * 页面的初始数据
	 */
	data: {
		newImg: 'https://shop.rongyiht.com/static/images/detail/new1.png',
		newImg1: 'https://shop.rongyiht.com/static/images/detail/new2.png',
		newImg2: 'https://shop.rongyiht.com/static/images/detail/new3.png',
		indicatorDots: false,
		vertical: false,
		autoplay: true,
		interval: 3000,
		duration: 500,
		project: '',
		title: 'Hello',
		functionBoxList: [{
				url: '/static/iphone15.png',
				title: '苹果旗舰'
			},
			{
				url: '/static/mianmo.png',
				title: '美容面膜'
			},
			{
				url: '/static/more.png',
				title: '更多新品',
			},
		],
		list: [
			'/static/lunbo1.png',
			'/static/lunbo2.png',
		],
		projectList: [],
		functionBoxList2: [{
				title: 'iPhone14 pro 全新国行急速发货',
				value: 1,
				url: 'https://shop.rongyiht.com/static/images/detail/iphone15.png',
				tipRed:'国行正品|下单立发',
				
			},
			{
				title: 'iPhone15 pro 全新国行急速发货',
				value: 2,
				url: 'https://shop.rongyiht.com/static/images/detail/iphone15.png',
				tipRed:'国行正品|下单立发',
			},
			{
				title: 'iPhone15 pro 全新国行急速发货',
				value: 2,
				url: 'https://shop.rongyiht.com/static/images/detail/iphone15.png',
				tipRed:'国行正品|下单立发',
			},
			{
				title: 'iPhone15 pro 全新国行急速发货',
				value: 2,
				url: 'https://shop.rongyiht.com/static/images/detail/iphone15.png',
				tipRed:'国行正品|下单立发',
			},
		],
	},
	/**
	 * 生命周期函数--监听页面加载
	 */

	onLoad() {

		var data = {};
		let that = this,
			banner = [];
		APP.http('post', '/index', data, function(res) {
			if (res.code == 1) {
				for (let i = 0; i < res.data.banner.length; i++) {
					banner.push({
						url: res.data.banner[i].banner_img
					})
				}
				that.setData({
					background: banner,
					project: res.data.project
				})

			} else {
				wx.showLoading({
					title: '拼命加载中',
				})
			}
		})
	},
	navi_to: function(e) {
		let id = e.currentTarget.dataset.id;
		APP.jump('../detail/detail?id=' + id);
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady() {

	},

	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow() {

	},

	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide() {

	},

	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload() {

	},

	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh() {

	},

	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom() {

	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage() {

	}
})
